package com.da.javatest.annotation;

import javax.annotation.PostConstruct;

import lombok.Data;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @author JokerDa.
 * @date 2020/12/23 15:04
 * Description:
 */
@Configuration
@ConditionalOnProperty(value = "test.enable", havingValue = "true")
@ConfigurationProperties(prefix = "test.config")
@Data
public class PropertyTest {
    private String name;

    @PostConstruct
    private void test() {
        // 可以load资源啥的
        System.out.println("ConditionalOnProperty测试！");
        System.out.println("name:" + name);
    }
}
